package wang.unclecat.hello;


import android.app.Application;
import android.content.Context;

import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy;

import ohos.abilityshell.HarmonyApplication;
import timber.log.Timber;


public class MyApp extends HarmonyApplication {
//public class MyApp extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);

        //log
        {
            FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
                    .methodCount(1)
                    .methodOffset(5)
                    .build();

            Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
            Timber.plant(new Timber.DebugTree() {
                @Override
                protected void log(int priority, String tag, String message, Throwable t) {
                    Logger.log(priority, tag, message, t);
                }
            });
        }
    }
}
